package cn.njxzc.book.masterexamples.ch14;

import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;



public class SetDemo4 {
    public static void main(String args[]) {
        boolean b;
        Set s = new TreeSet();
        b = s.add("string1");
        System.out.println("string1 add returns " + b);
        b = s.add("string2");
		System.out.println("string2 add returns " + b);
		b = s.add("string3");
        System.out.println("string3 add returns " + b);
        b = s.add("string1");
        System.out.println("string1 add returns " + b);
        b = s.add("string2");
        System.out.println("string2 add returns " + b);
       Iterator i = s.iterator();
        while (i.hasNext()) 
             System.out.println(i.next());
    }
}
